package lch.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import lch.constant.MessageConstant;

import lch.entity.Result;

import lch.pojo.Role;

import lch.service.CheckRoleService;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lch
 * @date 2019-12-19 20:19
 */
@RestController
@RequestMapping("/checkRoles")
public class CheckRoleController {

    @Reference//查找服务
    private CheckRoleService checkRoleService;


    @RequestMapping("/findAll")
    public Result findAll() {
        try {
            List<Role> list=checkRoleService.findAll();
            return new Result(true, MessageConstant.EDIT_CHECKITEM_SUCCESS,list);
        } catch (Exception e) {
            e.printStackTrace();
            //服务调用失败
            return new Result(false, "查询角色失败");
        }
    }
}
